Hash Lookup on a Hash Cluster
Selecting rows from a hash cluster with a specific Cluster Key is one of the fastest ways to retrieve data from a table - faster than indexes. If you are selecting from or joining to a hash cluster using the Cluster Key, make sure that Oracle is using the Cluster Key. Run the SQL though Explain Plan and find the TABLE ACCESS line for the table in question.
If the row reads TABLE ACCESS (HASH) MY_TABLE, then Oracle is using hash access. Otherwise...
- If there is no TABLE ACCESS line, then Oracle is finding all of the data it needs from an index or indexes. For joins this may be preferable, however for a single table read Hash access would probably be a little faster.
- If there is a TABLE ACCESS (FULL) line, then Oracle is performing a Full Table Scan.
- If there is a TABLE ACCESS (ROWID) line, then the line below will show the index being used.
In any of these cases, Oracle thinks that it's alternative plan is better than Hash access; it could be right; the only way to be sure is to force hash acccess and compare to the default plan. Add a
Still not using TABLE ACCESS (HASH)?
- Are you querying/joining on the ENTIRE cluster key with an equals clause. Range predicates (>[=], <[=], BETWEEN, LIKE) and NOT predicates cannot use Hash access.
- Are you joining to another table on the cluster key? To use Hash access, the clustered table must be the Outer table of a Nested Loops join.
©Copyright 2003